<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link href="../../../static/css/style.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../../../static/js/jquery.js"></script>
<script type="text/javascript" src="../../../static/js/getBrandAndProduct.js"></script>
<script type="text/javascript">
  let user = JSON.parse(localStorage.getItem("user"));
  var addProduct = {
    typeId:null,
    productModel:null,
    productUnit:null,
    productStatus:null,
    createId:null,
    createTime:null
  };

  function getParamCPA() {
    addProduct = {
      typeId:$("#cpa_Type").val(),
      productModel:$("#cpa_Model").val(),
      productUnit:$("#cpa_Unit").val(),
      productStatus:$("#cpa_Status").val(),
      createId:user.uid,
      createTime:$("#cpa_CreateTime").val()
    };
  }

  $(function () {
    brandListDDB();
    var time = new Date();
    $("#cpa_CreateName").val(user.uname);
    $("#cpa_CreateTime").val(time.toLocaleString());
  })

  function addOneProduct() {
    getParamCPA();
    var isTrue = confirm("是否添加");
    if (isTrue){
      $.ajax({
        url:"/purchase/addProduct",
        method:"post",
        data:addProduct,
        dataType:"JSON",
        success:function (rel) {
          if (rel.data){
            window.location.href="cplist";
          }
        }
      })
    }
  }

</script>
</head>

<body>
<div class="place"> <span>位置：</span>
  <ul class="placeul">
    <li>采购管理</li>
    <li>商品管理</li>
    <li>添加</li>
  </ul>
</div>
<div class="formbody">
  <div class="formtitle"><span>商品类型信息</span></div>
  <ul class="forminfo">
    <li>
      <label>品牌名称</label>
      <select class="dfBrand" onchange="productTypeListDDB()">
      	  <option value="">请选择</option>
<!--          <option>联想</option>-->
<!--          <option>海尔</option>-->
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>商品类型</label>
      <select class="dfProduct" id="cpa_Type">
      	  <option value="">请选择</option>
<!--          <option>笔记本</option>-->
<!--          <option>电视机</option>-->
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>商品型号</label>
      <input id="cpa_Model" type="text" class="dfinput" />
      <i>必填，不能超过50个字符</i>
    </li>
    <li>
      <label>单位</label>
      <input id="cpa_Unit" type="text" class="dfinput" />
      <i>必填，不能超过10个字符</i>
    </li>
    <li>
      <label>状态</label>
      <select class="dfselect" id="cpa_Status">
          <option value="1">可用</option>
          <option value="2">不可用</option>
        </select>
      <i>必选</i>
    </li>
    <li>
      <label>创建人</label>
      <input id="cpa_CreateName" type="text" value="马云" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>创建时间</label>
      <input id="cpa_CreateTime" type="text" value="2017-11-18 15:36:10" readonly="readonly" class="roinput" />
      <i>不能编辑</i>
    </li>
    <li>
      <label>&nbsp;</label>
      <input name="" type="button" class="btn" value="确定" onclick="addOneProduct()"/>
      &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      <input name="" type="button" class="btn" value="返回" onclick="window.location.href='cplist'"/>
    </li>
  </ul>
</div>
</body>
</html>
